home *** CD-ROM | disk | FTP | other *** search
/ Dioses Mayas / Dioses Mayas.iso / TITLE.MST < prev    next >
Text File  |  1997-02-26  |  14KB  |  436 lines

  1. '**************************************************************************
  2.     
  3.     '' Global variables
  4.  
  5.     GLOBAL TitleShortName$
  6.     GLOBAL TitleLongName$
  7.     GLOBAL Garabatos$
  8.     GLOBAL PromptForPath%
  9.     GLOBAL DefaultPath$
  10.     GLOBAL ProgManGroup$
  11.     GLOBAL ProgManItemGarabatos$
  12.  
  13.     '' ****************************************************************
  14.     '' ** Setup Variables
  15.     '' ****************************************************************
  16.  
  17.     '' Set the following string to a short form of the title name
  18.     '' (for example, "Gallery")
  19.     
  20.     TitleShortName$ = "Dioses Mayas"
  21.     
  22.     '' Set the following string to a long form of the title name
  23.     '' (for example, "Viewer 2.0 Gallery")
  24.     
  25.     '' TitleLongName$ = "Kimera - Cuentos para Leer, Colorear y jugar"
  26.  
  27.     '' Set the following variable to the name of the MVB file, without 
  28.     '' the filename extension (for example, "GALLERY")
  29.         
  30.     Garabatos$ = "Mayas"
  31.         
  32.     '' The following variable determines whether Setup prompts the user
  33.     '' to specify a directory in which to install title files. (Files
  34.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  35.     '' file under the [Installed Title Files] section.) Specify one of
  36.     '' the following values:
  37.     ''
  38.     '' 0    Install title files in the Windows directory (default setting).
  39.     ''      This is an appropriate setting if you have a limited number
  40.     ''      of files to copy (for example, a single custom icon or DLL).
  41.     ''
  42.     '' 1    Display a dialog box to prompt the user for a directory in 
  43.     ''      which to install files
  44.         
  45.     PromptForPath% = 1
  46.         
  47.     '' If you have specified 1 in PromptForPath%, set the following 
  48.     '' variable to the default path that will be displayed in the dialog
  49.     '' box (for example, "C:\GALLERY").
  50.         
  51.     DefaultPath$ = "C:\Kimera\Mayas"
  52.     
  53.     '' Set the following variable to the name of the program manager 
  54.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  55.         
  56.     '' ProgManGroup$ = "Kimera - Cuentos para Leer, Colorear y Jugar"
  57.     ProgManGroup$ = "Kimera - Cuentos"
  58.     
  59.     '' Set the following variable to the caption of the program manager 
  60.     '' item for your title (for example, "Gallery")
  61.         
  62.     ProgManItemGarabatos$ = "Dioses Mayas"
  63.     
  64.     '***********************************************************************
  65.     '** Mainline
  66.     '***********************************************************************
  67.  
  68.     GLOBAL CUIDLL$
  69.  
  70.     '' Include files
  71.     '$INCLUDE 'setupapi.inc'
  72.     
  73.     '' Custom UI dll
  74.     CUIDLL$ = "mscuistf.dll"
  75.     
  76.     '' Dialog ID's
  77.     CONST DESTPATH      = 1000
  78.     CONST APPHELP       = 2000
  79.     CONST TOOBIG        = 3000
  80.     CONST BADPATH       = 4000
  81.     CONST SUCCESS       = 5000
  82.     
  83.     '' Bitmap ID
  84.     CONST LOGO = 1
  85.     
  86.     '' Functions and subroutines
  87.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  88.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  89.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  90.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  91.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  92.     DECLARE SUB ModifyViewerIni
  93.     DECLARE SUB RegisterCustomFonts
  94.     DECLARE SUB ModifyProgramManager
  95.     DECLARE SUB ShowSuccess
  96.     DECLARE SUB RegisterDrivers
  97.     
  98.     '' The following statement turns size checking off. Set it to scmOnFatal 
  99.     '' to enable size checking, where Setup will compare the disk file size 
  100.     '' with the INF file size and report an error if they are not the same.
  101.     
  102.     i% = SetSizeCheckMode(scmOff)
  103.     
  104.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  105.     '' alter the banner bitmap.
  106.     
  107.     SetTitle "Kimera - Cuentos para Leer, Colorear y Jugar - Dioses Mayas"
  108.     SetBitmap CUIDLL$, LOGO 
  109.     
  110.     '' Read in the INF file.
  111.     
  112.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  113.     
  114.     '' Decide where to put title files
  115.     IF PromptForPath% = 1 THEN
  116.         szTitleDir$ = GetTitleDir(DefaultPath$)
  117.                 DefaultPath$ = szTitleDir$
  118.         IF szTitleDir$ = "" THEN
  119.             GOTO QUIT
  120.         ENDIF
  121.     ELSE
  122.         szTitleDir$ = GetWindowsDir()
  123.     ENDIF   
  124.     
  125.     '' Copy files
  126.     IF CopyFiles(szTitleDir$) = 0 THEN
  127.         GOTO QUIT
  128.     ENDIF
  129.  
  130.     '' Create the MVIEWER2.EXE MVB association 
  131.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  132.  
  133.     '' Register in VIEWER.INI
  134.     ModifyViewerIni
  135.  
  136.     '' Register custom fonts
  137.     RegisterCustomFonts
  138.  
  139.     '' Register drivers
  140.     RegisterDrivers
  141.     
  142.     '' Modify Program Manager
  143.     ModifyProgramManager    
  144.     
  145.     '' Success dialog
  146.     '' ShowSuccess
  147.     
  148.     '' Now start the title
  149.     '' RUN "mviewer2.exe " + MVBFileName$ + ".MVB", NOWAIT
  150.  
  151. QUIT:
  152.     
  153.     END
  154.     
  155.  
  156. '*************************************************************************
  157. '** Purpose:
  158. '**     Prompts the user for a path for the title files
  159. '** Arguments:
  160. '**     szDefault$ - default path
  161. '** Returns:
  162. '**     New valid path name, or "" if the user quit.
  163. '*************************************************************************
  164.  
  165. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  166.  
  167.     SetSymbolValue "String", TitleShortName$
  168.     SetSymbolValue "EditTextIn", szDefault$
  169.     SetSymbolValue "EditFocus", "ALL"
  170.  
  171.     GETPATH:
  172.  
  173.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  174.  
  175.     IF sz$ = "CONTINUE" THEN
  176.         szTitleDir$ = GetSymbolValue("EditTextOut")
  177.         IF IsDirWritable(szTitleDir$) = 0 THEN
  178.  
  179.             BADPATH:
  180.  
  181.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  182.             IF sz$ = "REACTIVATE" THEN
  183.                 GOTO BADPATH
  184.             END IF
  185.             UIPop 1
  186.             GOTO GETPATH
  187.         END IF
  188.         UIPop 1
  189.         CreateDir szTitleDir$, cmoNone
  190.     ELSEIF sz$ = "REACTIVATE" THEN
  191.         GOTO GETPATH
  192.  
  193.     ELSE
  194.         szTitleDir$ = ""
  195.  
  196.     END IF
  197.  
  198.     GetTitleDir = szTitleDir$
  199.  
  200. END FUNCTION
  201.  
  202.  
  203. '*************************************************************************
  204. '** Purpose:
  205. '**     Copies the files in the INF file
  206. '** Arguments:
  207. '**     szTitleDir$ - destination directory for the title files
  208. '** Returns
  209. '**     1 if files were copied, 0 otherwise
  210. '*************************************************************************
  211.  
  212. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  213.  
  214.     '' Add all system files to the copy list
  215.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  216.     
  217.     '' Add all of the title files to the copy list
  218.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  219.     
  220.     '' Check size
  221.     szExtras$ = "Extra"
  222.     szCosts$ = "Costs"
  223.     szNeededs$ = "Neededs"
  224.     FOR i% = 1 TO 26 STEP 1
  225.         AddListItem szExtras$, "0"
  226.     NEXT i%
  227.     
  228.     '' We assume that VIEWER.INI will take another 4K
  229.     ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  230.     
  231.     '' Get amount of space required
  232.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  233.     
  234.     '' Put up a message if there is not enough space
  235.     FOR i% = 1 TO 26 STEP 1
  236.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  237.     
  238.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  239.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  240.     
  241.             TOOBIG:
  242.     
  243.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  244.             IF sz$ = "REACTIVATE" THEN
  245.                 GOTO TOOBIG
  246.             END IF
  247.             UIPop 1
  248.             CopyFiles = 0
  249.             GOTO DONTCOPY
  250.         END IF
  251.     NEXT i%
  252.     
  253.     '' Copy the files
  254.     CopyFilesInCopyList
  255.     
  256.     CopyFiles = 1
  257.  
  258. DONTCOPY:
  259.  
  260. END FUNCTION
  261.  
  262.  
  263. '*************************************************************************
  264. '** Purpose:
  265. '**     Puts up a success dialog
  266. '*************************************************************************
  267.  
  268. SUB ShowSuccess STATIC
  269.  
  270.     SUCCESS:
  271.     
  272.     SetSymbolValue "String1", TitleShortName$
  273.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  274.     IF sz$ = "REACTIVATE" THEN
  275.         GOTO SUCCESS
  276.     END IF
  277.     UIPop 1
  278.     
  279. END SUB
  280.  
  281.  
  282. '*************************************************************************
  283. '** Purpose:
  284. '**     Appends a file name to the end of a directory path,
  285. '**     inserting a backslash character as needed.
  286. '** Arguments:
  287. '**     szDir$  - full directory path (with optional ending "\")
  288. '**     szFile$ - filename to append to directory
  289. '** Returns:
  290. '**     Resulting fully qualified path name.
  291. '*************************************************************************
  292.  
  293. FUNCTION Mak